//
//  MapIcon.m
//  Operator
//
//  Created by Ardi Tjandra on 12/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MapIcon.h"

@implementation MapIcon

@synthesize coordinate = _coordinate;
@synthesize type       = _type;
@synthesize ID         = _ID;
@synthesize title      = _title;
@synthesize bindingId  = _bindingId;
@synthesize updated    = _updated;

-(id) initWithCoordinate:(CLLocationCoordinate2D)coordinate 
          annotationType:(MapIconType) type
            annotationId:(NSString *)ID
                   title:(NSString*)title {
    self = [super init];
    _coordinate = coordinate;
    _type       = type;
    _ID         = [ID retain];
    _title      = [title retain];
    _bindingId  = nil;
    _updated    = true;
    return self;
}

- (NSString *)subtitle {
	NSString* subtitle = nil;
	
	if( _type == MapIconTypeOwnRunner || 
	    _type == MapIconTypeOwnHunter ||
	    _type == MapIconTypeOtherRunner ||
	    _type == MapIconTypeOtherHunter ||
      _type == MapIconTypeBase ) {
        subtitle = [NSString stringWithFormat:@"%lf, %lf", _coordinate.latitude, _coordinate.longitude];
	}
	
	return subtitle;
}

-(void) dealloc {
    [_ID release];
    [_title release];
    [_bindingId release];
    [super dealloc];
}

-(void) setCoordinate:(CLLocationCoordinate2D)coordinate {
    _coordinate = coordinate;
}

@end
